home *** CD-ROM | disk | FTP | other *** search
- /* repchar function Copyright 1992 by Chuck Steenburgh
-
- This function will replace all instances of a given character
- in a string with another
-
- repchar accepts the following arguments:
-
- char *s - string in which character(s) are to be replaced
- char c - character to be replaced
- char r - replacement character
-
- Returns: number of character replaced
- */
-
- int repchar(char *s, char c, char r)
-
- {
- /* local variable */
- int counter=0;
-
- while (s = strchr(s,c)) {
- *s = r;
- counter++;
- }
-
- return counter;
- }
-